<div class="row">
    <div class="col-xs-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><span class="glyphicon glyphicon-list-alt"></span>使用说明</h3>
            </div>
            <div class="panel-body">
                <p style="text-indent: 2em;">此页面用于创建新的主应用,如：[admin--后台等]。
                    创建的模块将位于应用目录...</p>
                <p>
                    服务器url地址：<?= _HOST_?> <br>
                    服务器根目录：<?= ROOT_PATH?> <br>
                    当前应用目录：<?= PROJECT_PATH?></p>
            </div>
        </div>
    </div>
</div>
<div class="row">

    <div class="col-xs-8 col-md-offset-2">
        <form action="_ACTION_" method="post"onsubmit="return form_check()"
              class="form-horizontal">

            <fieldset>
                <legend><span class="glyphicon glyphicon-pencil"></span>创建新的应用</legend>
                <div style="display: none" id="notice_msg" class="alert alert-danger">
                    <!-- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> -->
                    应用名称不合法,仅允许创建2-10位以大小写字母、下划线为名称的应用名
                </div>
                <div id="input_app_name" class="form-group">
                    <label for="create_app_name" class="col-lg-3 control-label">新创建应用名称
                    <span style="color:red;">*</span></label>
                    <div class="col-lg-9">
                        <input type="text" class="form-control" placeholder="新的应用名称"
                        onblur="form_check()" onkeyup="form_check()"
                               name="app_name" id="create_app_name">
                        <span id="check_ok" class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span id="check_fail" class="glyphicon glyphicon-remove form-control-feedback"></span>
                    </div>
                </div>
                <div id="input_app_path" class="form-group">
                    <label for="create_app_path" class="col-lg-3 control-label">创建应用的目录
                    <span style="color:red;">*</span></label>
                    <div class="col-lg-9">
                        <input type="text" class="form-control" placeholder="创建应用的目录"
                               name="app_path" id="create_app_path"
                               value="<?= dirname(rtrim(PROJECT_PATH,'/')).'/';?>">
                        </div>
                </div>
                <div class="form-group">
                       <div class="col-lg-8 col-lg-offset-4">
                           <button style="width:200px;" class="btn btn-primary btn-lg" type="submit">
                               <span class="glyphicon glyphicon-send"></span>
                               创 建 应 用
                           </button>
                       </div>
                   </div>
            </fieldset>

        </form>
    </div>
    <!--######## js #########-->
           <script>
               function get(id){return document.getElementById(id);}
               function form_check()
               {
                   var notice_msg = get('notice_msg');
                   var c_app = get('create_app_name');
                   var input_app_name = get('input_app_name');
                   var check_ok = get('check_ok');
                   var check_fail = get('check_fail');
                   var c_app_v = c_app.value;
                   //alert(c_app_v);

                   var yuan_value = "<?= dirname(rtrim(SITE_PATH,'/')).'/';?>";
                   if (c_app_v ==''){
                       notice_msg.style.display= check_fail.style.display =check_ok.style.display='none';
                       input_app_name.className='form-group ';
                       get('create_app_path').value =yuan_value;
                   } else {
                        get('create_app_path').value =yuan_value+c_app_v;
                        var reg = /^[A-Za-z_]{2,10}$/g;
                       if ( !reg.test( c_app_v ) ) //reg.test()用正则测试输入是否合法
                       {
                           //alert('模块名称不合法');
                           notice_msg.style.display= check_fail.style.display='block';
                           check_ok.style.display='none';
                           //c_app.style.borderColor = '#F60';
                           input_app_name.className='form-group has-error has-feedback';
                           return false;
                       }
                       notice_msg.style.display= check_fail.style.display='none';
                       input_app_name.className='form-group has-success has-feedback';
                       check_ok.style.display='block';
                       return true;
                   }
               }
           </script>
           <!--#################-->
</div><!--end div.row-->